// pages/unusedorder/unusedorder.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isTrue:false,
    OrderNo:null,
    info:[],
    userInfo:[],
    token:null,
    info:[],
    goodsList:[],
    Discount:0, //打折
    goodsListTotalPrice:0, //折后
    buydiscount:0, //折扣金额
    vouchers:0, //代金券
    realpay:1400.00,  //实付金额
    csorderno:'',
  },
   //返回上一页
 navigateBack() {
  wx.navigateBack({
    delta: 1
  })
},
  //获取订单详情
  getorderinfolist(e){
    let _this = this
    let OrderNo = _this.data.OrderNo
    let token = wx.getStorageSync('token')
    wx.request({
      url: 'https://www.yulonging.com/dwweb/wxapi.ashx',
      data: {
       //请求后台的分页数据
       cmd:'GetOrderInfo',
       token:token,
       OrderNo:OrderNo
      },
      method: "get",
      success(res) {
       var data = res.data.DATA;
       var goodsList = data[0].GoodsList
       console.log(data);
       let goodsListTotalPrice = 0
       goodsList.forEach((item, index) => {
        item.num = item.Nums
        item.totalPrice = item.Price * item.num
        goodsListTotalPrice += parseFloat(item.totalPrice)
      })
       _this.setData({
        info:data[0],
        finsTotalprice:data[0].TotalFee,
        Discount:data[0].Discount*10,
        goodsList:goodsList,
        buydiscount:data[0].RoomFee+'*'+data[0].Discount+'='+data[0].RoomFeeDis,
        goodsListTotalPrice:goodsListTotalPrice
      })
      }
   })
  },
  //邀请参会人
  // getorderfor(){
  //   //跳转详情页面
  //   let that=this
  //   wx.navigateTo({
  //     url: '/pages/Invitationandsharing/Invitationandsharing?OrderNo='+that.data.OrderNo,
  //   })
  // },

  addsms(e){
    let that = this
    let OrderNo = that.data.OrderNo
      wx.navigateTo({
        url: '../smsInvitation/smsInvitation?OrderNo='+OrderNo,
      })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options);
    let  userInfo=  wx.getStorageSync('userInfo')
    let  token=  wx.getStorageSync('token')
    let that = this
    that.setData({
      OrderNo:options.OrderNo
    })
    that.getorderinfolist()//初始化调用订单信息
  },
/*取消订单*/
  onBacktorule(e){
    let that = this;
    that.setData({
      isTrue:true
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

})